package com.weshare.nd.netty.contex;

import io.netty.channel.Channel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ChatContex {

    private static Map<String, Channel> sessionContex = new ConcurrentHashMap<String, Channel>();

    public static Map<String, Channel> getSessionContex() {
        return sessionContex;
    }

    public static void addChannel(String name, Channel channel){
        sessionContex.put(name, channel);
    }

    public static void removeChannel(String name){
        if(name != null){
            sessionContex.remove(name);
        }
    }

    public static Channel getChannel(String name){

        Channel channel = sessionContex.get(name);

        return channel;
    }
}
